{extend name="pc/admin/layout"/}
{block name="main"}
   <div class="g-1400 g-container" id="pjax-container">
        
<div class="bg-bai b rx3" id="vue-page">
<form id="form-config">
    <div class="t-v t-t">
        <div class="c-sidebar c-sidebar-h pb5 br">
            <div class="c-sidebar-title t-v hui bb">网站基础设置</div>
            <ul class="c-nav click-nav">
                <li><a href="{:url('pc/admin')}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>网站信息</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'reg'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>注册奖励</div>
                </a></li>
				<li class="active"><a href="{:url('pc/admin',['act'=>'set','s'=>'mail'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>邮箱提醒</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'chat'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>聊天发言</div>
                </a></li>
				{if condition="config('web_web_id') eq 1"}
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'task'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>任务运行</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'cron'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>任务监控</div>
                </a></li>
				{/if}
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'plugins'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>网站插件</div>
                </a></li>
				{if condition="config('web_web_id') eq 1"}
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'server'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>服务器设置</div>
                </a></li>
				{/if}
            </ul>
        </div>
<div class="c-content bl">
            <div class="col-6 fl br" style="min-height:420px;">
                <div class="g-title t-v pl4 bb">
                    <div class="col-12 h t-v bold">邮件通知开关</div>
                </div>
				<div class="p5 o-h">
        <div class="pt1 pb3 in-text">
            <dt class="bold bb pr2 lan">添加QQ邮件提醒</dt>
            <dd><select class="form w h8 bb" name="is_addqq_msg" default="{:config('sys_is_addqq_msg')}">
                <option value="0">关闭</option>
                <option value="1" {if condition="config('sys_is_addqq_msg') eq 1" }selected {/if}>开启</option>
            </select></dd>
        </div>
		<div class="pt1 pb3 in-text">
            <dt class="bold bb pr2 lan">QQ失效邮件提醒</dt>
            <dd><select class="form w h8 bb" name="is_nqqzt_msg" default="{:config('sys_is_nqqzt_msg')}">
                <option value="0">关闭</option>
                <option value="1" {if condition="config('sys_is_nqqzt_msg') eq 1" }selected {/if}>开启</option>
            </select></dd>
        </div>
		</div>
            </div>
            <div class="col-6 fl bl" style="margin-left:-1px;">
                <div class="g-title t-v pl4 bb">
                    <div class="col-12 h t-v bold">邮箱发信配置</div>
                </div>
				<div class="p5 o-h">
				<div class="pt1 pb3 in-text">
					<dt class="bold bb pr2 lan">邮件发信接口</dt>
					<dd><select class="form w h8 bb" name="is_mail_api" default="{:config('sys_is_mail_api')}">
						<option value="0">官方Api</option>
                        <option value="1" {if condition="config('sys_is_mail_api') eq 1" }selected {/if} >本地发信</option>
					</select></dd>
				</div>
				<div id="show_m1" style="display: none">
				<div class="pt1 pb3 in-text">
				<dt class="bold bb pr2 lan">SMTP服务器</dt>
				<dd><input type="text" class="form w h8 bb"  name="mail_smtp" value="{:config('sys_mail_smtp')}"></dd>
				</div>
				<div class="pt1 pb3 in-text">
				<dt class="bold bb pr2 lan">发信端口</dt>
				<dd><input type="text" class="form w h8 bb" name="mail_port" value="{:config('sys_mail_port')}"></dd>
				</div>
				<div class="pt1 pb3 in-text">
				<dt class="bold bb pr2 lan">发信邮箱</dt>
				<dd><input type="text" class="form w h8 bb" name="mail_name" id="sendmail" value="{:config('sys_mail_name')}"></dd>
				</div>
				<div class="pt1 pb3 in-text">
				<dt class="bold bb pr2 lan">邮箱密码</dt>
				<dd><input type="text" class="form w h8 bb" name="mail_pwd" value="{:config('sys_mail_pwd')}"></dd>
				</div>
				</div>
				<div id="show_m2" style="display: none">
                 <div class="pt6 pb4">
					<button type="button" class="btn btn-qing btn-md btn-block rx1" @click="testSendMail()">测试发信</button>
				</div>
                </div>
		</div>
            </div>
        </div>
</div>
</form>
<div class="c-pagination o-h t-v">
        <div class="c-sidebar"></div>
        <div class="c-content h11 o-h g-btn t-v bt bl">
            <div class="col-12 h t-v f3 hui pl5 pr5 t-c">
			<button class="btn btn-qing btn-md w22 rx1" @click="saveConfig()">保 存 设 置</button></div>
        </div>
    </div>
</div>

    </div>
   {/block}
   {block name='foot'}
		<script>
        new Vue({
                el: '#vue-page',
                methods: {
                    saveConfig: function () {
                        app.ajax("{:url('admin_ajax/config')}", $("#form-config").serialize(), function (data) {
                            if (data.code === 0) {
                                x.msg(data.message, 2)
                            } else {
                                x.msg(data.message, 2)
                            }
                        })
                    },
                    testSendMail: function () {
                        var mail = $("#sendmail").val();
                        app.ajax("{:url('admin_ajax/testSendMail')}", {mail: mail}, function (data) {
                            if (data.code === 0) {
                                x.msg(data.message)
                            } else {
                                x.msg(data.message)
                            }
                        });
                    }
                }
            });
            $("select[name='is_mail_api']").change(function () {
                if ($(this).val() == 1) {
                    $("#show_m1").css("display", "inherit");
                    $("#show_m2").css("display", "inherit");
                } else {
                    $("#show_m1").css("display", "none");
                    $("#show_m2").css("display", "none");
                }
            });
            if ($("select[name='is_mail_api']").val() == 1) {
                $("#show_m1").css("display", "inherit");
                $("#show_m2").css("display", "inherit");
            }
    </script>
    {/block}